home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2982 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.6 KB

  1. Path: dartvax.dartmouth.edu!NewsWatcher!user
  2. From: Robert.Lendvai@dartmouth.edu (Robert Lendvai)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: [] overload..(newbie in distress)
  5. Date: Sun, 21 Jan 1996 01:17:54 -1000
  6. Organization: Dartmouth College
  7. Message-ID: <Robert.Lendvai-2101960118330001@129.170.80.94>
  8. References: <DLGppJ.31C@undergrad.math.uwaterloo.ca>
  9. NNTP-Posting-Host: atgw-kip-1-94.dartmouth.edu
  10.  
  11. In article <DLGppJ.31C@undergrad.math.uwaterloo.ca>,
  12. tthiraku@landen.math.uwaterloo.ca (Thanou Thirakul) wrote:
  13.  
  14. > Hi..
  15. > I'm currently stuck on how to overload [] operator such that
  16. > it does two different tasks..
  17. > case 1:
  18. > // A is an instance of a class that contains a linkist.
  19. >    A[5] = val;  // store val into the fifth node of a linklist. 
  20. >    val = A[5] ; // returns the value of the fifth node of a linklist.  
  21. > I was wondering how can C++ differentiate these two senerios? 
  22. > Anything help will greatly appreciated..
  23. > Thank You Kindly
  24. > -- 
  25. > Thanou Thirakul
  26. > tthiraku@undergrad.math.uwaterloo.ca
  27. > http://www.undergrad.math.uwaterloo.ca/~tthiraku
  28. >  ___________________________________________________________
  29. > |                                                           |
  30. > | <after submitting a CS assignment>                        |
  31. > |                                                           |
  32. > |  "Well, that was the most well-documented non-working     |
  33. > |   piece of code I have ever written.. " -unknown          |
  34. > |                                                           |
  35. > |___________________________________________________________|
  36.  
  37. The = assignment operator can not be overloaded.
  38.